#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10;
int n,res,arr[N];
struct node{
    int power;
    int number;
}sum[N];
inline int read(){
    int f=1,ans=0;
    char c=getchar();
    while(c>'9'||c<'0'){
        if(c=='-') f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        ans=ans*10+c-'0';
        c=getchar();
    }
    return ans*f;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=read();
    for(int i=1;i<=n;i++) arr[i]=read();
    sort(arr+1,arr+1+n);
    int id=1,num=arr[1],cnt=1;
    for(int i=2;i<=n;i++){
        if(num!=arr[i]){
            sum[id].power=num;
            sum[id].number=cnt;
            num=arr[i];
            id++;
            cnt=1;
        }
        else cnt++;
    }
    sum[id].number=cnt;
    sum[id].power=num;
    num=sum[1].number;
    for(int i=2;i<=n;i++){
        if(sum[i].number>=num){
            res+=num;
            num=sum[i].number;
        }
        else{
            res+=sum[i].number;
        }
    }
    cout<<n-res;
    return 0;
}
